<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="jdk.pojo.*" import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>主页</title>
</head>
<body>

<p>
   <% if(session.getAttribute("name")!=null){//如果已经登陆
	      out.print("欢迎"+session.getAttribute("name")+"|");
          out.print("<a href=\"ViewBlogAction.jdk?QbIndexShowCon=allBlog\">我的博客</a>"+"|");
          out.print("<a href=\"ExitAction.jdk\">退出</a>");
      } else{
    	  out.print("<a href=\"login.jsp\">登陆</a>|<a href=\"reg.jsp\">注册</a>");
      }
   %> 
</p>
<hr/>

<!-- 以下部分显示所有博客 ，先设置登陆成功才能查看-->
<table>
       <tr><td>标题</td></tr>
       <%
            if(session.getAttribute("name")!=null){//如果登陆成功
            	List<Articales> artLists=(List<Articales>)session.getAttribute("allArtLists");
                //循环输出所有博客的内容
                for(Articales a:artLists){
                	//将博客的ID作为参数提交到servlet处理
                	out.print("<tr><td><a href=\"ViewBlogAction.jdk?QbIndexShowCon=oneBlog&QblogID="+a.getId()+"\">"+a.getTitle()+"</a></td></tr>");
                }
                session.removeAttribute("artLists");
            }
       %>
       
</table>
</body>
</html>